package com.sphd.Restaurant.activity;

import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.widget.Button;
import android.widget.EditText;

import com.sphd.Restaurant.R;
import com.sphd.Restaurant.base.BaseActivity;
import com.sphd.Restaurant.utils.AppManager;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.pedant.SweetAlert.SweetAlertDialog;

public class FeedbackActivity extends BaseActivity {

    @BindView(R.id.toolbar)
    Toolbar toolbar;
    @BindView(R.id.et_feedback)
    EditText etFeedback;
    @BindView(R.id.bt_feedback)
    Button btFeedback;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_feedback);
        AppManager.getAppManager().addActivity(this);

        ButterKnife.bind(this);
        initView();
    }

    private void initView() {
        setToolBar(toolbar, "意见反馈", true);
        toolbar.setNavigationOnClickListener(view -> AppManager.getAppManager().finishActivity(this));
    }

    @OnClick(R.id.bt_feedback)
    public void onClick() {
        if (!TextUtils.isEmpty(etFeedback.getText())) {
            new SweetAlertDialog(FeedbackActivity.this, SweetAlertDialog.SUCCESS_TYPE)
                    .setTitleText("提交成功")
                    .show();
            etFeedback.setText("");
        }else{
            new SweetAlertDialog(FeedbackActivity.this, SweetAlertDialog.ERROR_TYPE)
                    .setTitleText("意见反馈不能为空")
                    .show();
        }
    }

}
